package com.yaowk.system.api;

import com.yaowk.common.api.PageReq;
import com.yaowk.common.api.PageResp;
import com.yaowk.common.api.model.result.CheckboxTree;
import com.yaowk.common.api.model.result.Tree;
import com.yaowk.system.api.model.Menu;
import com.yaowk.system.api.model.Role;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient("system")
@RequestMapping("/system/role")
public interface RoleApi {

    @GetMapping("/{id}")
    Role findOne(@PathVariable Long id);

    @GetMapping
    PageResp<Role> list(Role role, PageReq pageReq);

    @PostMapping
    Role save(Role role);

    @DeleteMapping("/{id}")
    public void delete(@PathVariable Long id);

    @GetMapping("/{roleId}/menu")
    public CheckboxTree<Tree<Menu, Long>, Long> menuList(@PathVariable Long roleId);

    @PostMapping("/{roleId}/menu")
    void menuEdit(@PathVariable Long roleId, @RequestParam(required = false) List<Long> menuId);

}
